<?php

namespace Yon\fi;

use Yon\Lib\Base;
use Yon\Lib\Tools;

class Voucher extends Base {

    /**
     * 凭证保存接口
     * @return void
     */
    public function add($data){
        $url = "/yonbip/fi/ficloud/openapi/voucher/addVoucher?access_token=ACCESS_TOKEN";
        $this->registerApi($url, func_get_args());
        $options['headers'][] = "Content-Type:application/json";
        return Tools::json2arr(Tools::post($url,$data,$options));
    }

    /**
     * 凭证列表查询
     * @param $data
     * @return bool|string
     * @throws \WeChat\Exceptions\InvalidResponseException
     * @throws \WeChat\Exceptions\LocalCacheException
     */
    public function query($data){
        $url = "/yonbip/fi/ficloud/openapi/voucher/queryVouchers?access_token=ACCESS_TOKEN";
        $this->registerApi($url, func_get_args());
        $options['headers'][] = "Content-Type:application/json";
        return Tools::json2arr(Tools::post($url,$data,$options));
    }
}